!(function () {
    const body = $('body');
    // 初始化主菜单
    const MenuConfig = [
        {
            name: '主菜单', icon: 'home', path: './index.html', children: [
                { name: '子菜单', icon: 'home', path: './index.html' },
                { name: '子菜单', icon: 'home', path: './index.html' },
                { name: '子菜单', icon: 'home', path: './index.html' },
                { name: '子菜单', icon: 'home', path: './index.html' },
            ]
        },
        { name: '主菜单', icon: 'home', path: './index.html', children: [] },
        { name: '主菜单', icon: 'home', path: './index.html', children: [] },
        { name: '主菜单', icon: 'home', path: './index.html', children: [] },
    ];
    const Menu = $('.main-menu');

    for (let i = 0; i < MenuConfig.length; i++) {
        const item = MenuConfig[i];
        let MenuHtml = '';
        let ChildHtml = '';

        if (item.children && item.children.length > 0) {
            ChildHtml += `    <div class="main-menu-item-child-box"> \n`
            for (let d = 0; d < item.children.length; d++) {
                const child = item.children[d];
                ChildHtml += `        <div class="main-menu-item-child-item"> \n`
                ChildHtml += `            <a href="${item.path}"> \n`
                ChildHtml += `              <i class="fa fa-${child.icon}"></i> \n`
                ChildHtml += `              <span>${child.name}</span> \n`
                ChildHtml += `            </a> \n`
                ChildHtml += `        </div> \n`
            }
            ChildHtml += `    </div> \n`
        }
        MenuHtml += `<div class="main-menu-item"> \n`
        MenuHtml += `   <a href="${item.path}"> \n`
        MenuHtml += `       <i class="fa fa-${item.icon}" aria-hidden="true"></i> \n`
        MenuHtml += `       <span>${item.name}</span> \n`
        MenuHtml += `   </a> \n`
        MenuHtml += ChildHtml;
        MenuHtml += `</div> \n`

        console.log(MenuHtml);
        
        Menu.append($(MenuHtml));
    }

    // 




    const Conten = $('.main-content-box');
})();